CSS/HTML

推荐列表 站点导航

当前位置:首页 > 脚本编程 > CSS/HTML >

layui怎么做图片在列表中显示

来源:网络整理  作者:  发布时间:2020-12-19 17:08
layui列表中显示图片的方法:图片需要用到模板.templet,使用div样式将图片放到表格中,然后通过css设置其样式。...

图片需要用到模板.templet:

layui table中显示图片的方法:

注意div不可省略,48px指的是div的高度,如果要决定img图片的高度,需要单独设计style

<script type="text/javascript"> layui.use('table',function () { var table= layui.table; table.render({ elem:'#needstable' ,url:'{:url()}' ,method:'post' ,cellMinWidth:80 ,page:true ,cols:[[ {field:'needs_id',title:'id',fixed:'left',width:80} ,{field:'wx_username',title:'昵称',fixed:'left',width:80} ,{field:'wx_headimg',title:'头像',fixed:'left',templet:'<div><img src=https://www.ym97.com/wenku/cssm"{{ d.wx_headimg}}"></div>',style:'height:48px;width:48px;line-height:48px!important;'}

css,注意替换headimg

<style type="text/css">.layui-table-fixed-r td{height:58px!important;} .layui-table-fixed-r th{height:58px!important;} .layui-table img { max-width: 48px;min-height: 48px; } .laytable-cell-3-wx_headimg ,.laytable-cell-1-wx_headimg,.laytable-cell-2-wx_headimg,.laytable-cell-3-wx_headimg,.laytable-cell-4-wx_headimg,.laytable-cell-5-wx_headimg,.laytable-cell-6-wx_headimg,.laytable-cell-7-wx_headimg,.laytable-cell-8-wx_headimg,.laytable-cell-9-wx_headimg,.laytable-cell-10-wx_headimg,.laytable-cell-11-wx_headimg,.laytable-cell-12-wx_headimg,.laytable-cell-13-wx_headimg,.laytable-cell-14-wx_headimg{ width: 48px!important;;padding:0px!important;height: 48px!important;; line-height: 48px!important;; } </style>

推荐:layui框架教程

以上就是layui怎么做图片在列表中显示的详细内容,更多请关注聚合云库其它相关文章!


layui怎么做图片在列表中显示

相关热词:

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://v30.fanwenzhu.com/jiaob/cssm/5689.shtml

Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

layui怎么做图片在列表中显示

2020-12-19 编辑:

图片需要用到模板.templet:

layui table中显示图片的方法:

注意div不可省略,48px指的是div的高度,如果要决定img图片的高度,需要单独设计style

<script type="text/javascript"> layui.use('table',function () { var table= layui.table; table.render({ elem:'#needstable' ,url:'{:url()}' ,method:'post' ,cellMinWidth:80 ,page:true ,cols:[[ {field:'needs_id',title:'id',fixed:'left',width:80} ,{field:'wx_username',title:'昵称',fixed:'left',width:80} ,{field:'wx_headimg',title:'头像',fixed:'left',templet:'<div><img src=https://www.ym97.com/wenku/cssm"{{ d.wx_headimg}}"></div>',style:'height:48px;width:48px;line-height:48px!important;'}

css,注意替换headimg

<style type="text/css">.layui-table-fixed-r td{height:58px!important;} .layui-table-fixed-r th{height:58px!important;} .layui-table img { max-width: 48px;min-height: 48px; } .laytable-cell-3-wx_headimg ,.laytable-cell-1-wx_headimg,.laytable-cell-2-wx_headimg,.laytable-cell-3-wx_headimg,.laytable-cell-4-wx_headimg,.laytable-cell-5-wx_headimg,.laytable-cell-6-wx_headimg,.laytable-cell-7-wx_headimg,.laytable-cell-8-wx_headimg,.laytable-cell-9-wx_headimg,.laytable-cell-10-wx_headimg,.laytable-cell-11-wx_headimg,.laytable-cell-12-wx_headimg,.laytable-cell-13-wx_headimg,.laytable-cell-14-wx_headimg{ width: 48px!important;;padding:0px!important;height: 48px!important;; line-height: 48px!important;; } </style>

推荐:layui框架教程

以上就是layui怎么做图片在列表中显示的详细内容,更多请关注聚合云库其它相关文章!


layui怎么做图片在列表中显示

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://v30.fanwenzhu.com/jiaob/cssm/5689.shtml